package com.demo2do.fms.entity.authority;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 角色模板与资源关系
 * 
 * @author Ysy
 *
 */
@Entity
@Table(name = "FMS_ROLE_TEMPLATE_RESOURCE")
public class RoleTemplateResource {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
    @SequenceGenerator(name = "generator", sequenceName = "HIBERNATE_SEQUENCE", allocationSize = 1)
    private Long id;
    
    /** 角色模板  */
    @Enumerated(EnumType.STRING)
    @Column(name = "ROLE_TEMPLATE")
    private RoleTemplate template;
    
    /** 资源  */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Resource resource;
    
    /** 资源名称  */
    private String resourceName;

    /**
     * the default constructor
     */
    public RoleTemplateResource() {
    }
    
    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the template
     */
    public RoleTemplate getTemplate() {
        return template;
    }

    /**
     * @return the resource
     */
    public Resource getResource() {
        return resource;
    }
    
    /**
     * @return the resourceName
     */
    public String getResourceName() {
        return resourceName;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param template the template to set
     */
    public void setTemplate(RoleTemplate template) {
        this.template = template;
    }

    /**
     * @param resource the resource to set
     */
    public void setResource(Resource resource) {
        this.resource = resource;
    }
    
    /**
     * @param resourceName the resourceName to set
     */
    public void setResourceName(String resourceName) {
        this.resourceName = resourceName;
    }
    
}
